<body>
	<title>post online test</title>
	<h1>post online test</h1>
	<input id="submit" type="submit" value="Submit" />
  <!--
	<input id="url" type="text" style="width:340" value="http://192.168.1.83:80/ts/sql/warn_select" /><br>
  -->
	<input id="url" type="text" style="width:340" value="http://0.0.0.0:16667/ts/sql/insert" /><br>
	content:<br/>
	<textarea name="comments" id="content" style="width:80%;height:30%">
{
	"verison": "1.0.0",
	"table": "gcc",
	"data": [{
		"question": "22",
		"environment": "s22"
	}],
	"method": "post_mqtt"
}
	</textarea><br/>
	response:<br/>
	<textarea name="comments" id="response" style="width:80%;height:30%">
	no response!
	</textarea><br/>
	<script LANGUAGE="JAVASCRIPT">
		var url = document.getElementById("url");
		var content = document.getElementById("content");
		var response = document.getElementById("response");
		submit.onclick = function(){
			console.log("url:" + url.value);
			console.log("content:" + content.value);
			var xhttp = new XMLHttpRequest();
			xhttp.open("POST", url.value, false);
			//xhttp.setRequestHeader('content-type', 'application/json');
			//xhttp.send(JSON.stringify(content.value));
			//xhttp.setRequestHeader('content-type', 'x-www-form-urlencoded');
			xhttp.setRequestHeader('content-type', 'text/plain');
			xhttp.send(content.value);
			response.value = xhttp.responseText;
			console.log("response:" + xhttp.responseText);
		}
	</script>
</body>

